package com.nxy.cpfsfe.enumtype;

public enum DBErrorCdEnum {

	DB_ERROR1005("1005",RespCd.NCPS5001,"创建表失败"),
	DB_ERROR1006("1006",RespCd.NCPS5001,"创建数据库失败"),
	DB_ERROR1007("1007",RespCd.NCPS5001,"数据库已存在，创建数据库失败"),
	DB_ERROR1008("1008",RespCd.NCPS5001,"数据库不存在，删除数据库失败"),
	DB_ERROR1009("1009",RespCd.NCPS5001,"不能删除数据库文件导致删除数据库失败"),
	DB_ERROR1010("1010",RespCd.NCPS5001,"不能删除数据目录导致删除数据库失败"),
	DB_ERROR1011("1011",RespCd.NCPS5001,"删除数据库文件失败"),
	DB_ERROR1012("1012",RespCd.NCPS5001,"不能读取系统表中的记录"),
	DB_ERROR1020("1020",RespCd.NCPS5001,"记录已被其他用户修改"),
	DB_ERROR1021("1021",RespCd.NCPS5001,"硬盘剩余空间不足，请加大硬盘可用空间"),
	DB_ERROR1022("1022",RespCd.NCPS5001,"关键字重复，更改记录失败"),
	DB_ERROR1023("1023",RespCd.NCPS5001,"关闭时发生错误"),
	DB_ERROR1024("1024",RespCd.NCPS5001,"读文件错误"),
	DB_ERROR1025("1025",RespCd.NCPS5001,"更改名字时发生错误"),
	DB_ERROR1026("1026",RespCd.NCPS5001,"写文件错误"),
	DB_ERROR1032("1032",RespCd.NCPS5001,"记录不存在"),
	DB_ERROR1036("1036",RespCd.NCPS5001,"数据表是只读的，不能对它进行修改"),
	DB_ERROR1037("1037",RespCd.NCPS5001,"系统内存不足，请重启数据库或重启服务器"),
	DB_ERROR1038("1038",RespCd.NCPS5001,"用于排序的内存不足，请增大排序缓冲区"),
	DB_ERROR1040("1040",RespCd.NCPS5001,"已到达数据库的最大连接数，请加大数据库可用连接数"),
	DB_ERROR1041("1041",RespCd.NCPS5001,"系统内存不足"),
	DB_ERROR1042("1042",RespCd.NCPS5001,"无效的主机名"),
	DB_ERROR1043("1043",RespCd.NCPS5001,"无效连接"),
	DB_ERROR1044("1044",RespCd.NCPS5001,"当前用户没有访问数据库的权限"),
	DB_ERROR1045("1045",RespCd.NCPS5001,"不能连接数据库，用户名或密码错误"),
	DB_ERROR1048("1048",RespCd.NCPS5003,"字段不能为空"),
	DB_ERROR1049("1049",RespCd.NCPS5001,"数据库不存在"),
	DB_ERROR1050("1050",RespCd.NCPS5001,"数据表已存在"),
	DB_ERROR1051("1051",RespCd.NCPS5001,"数据表不存在"),
	DB_ERROR1054("1054",RespCd.NCPS5001,"字段不存在 (SQLSTATE: 42S22 )"),
	DB_ERROR1065("1065",RespCd.NCPS5001,"无效的SQL语句，SQL语句为空"),
	DB_ERROR1081("1081",RespCd.NCPS5001,"不能建立Socket连接"),
	DB_ERROR1114("1114",RespCd.NCPS5001,"数据表已满，不能容纳任何记录"),
	DB_ERROR1116("1116",RespCd.NCPS5001,"打开的数据表太多"),
	DB_ERROR1129("1129",RespCd.NCPS5001,"数据库出现异常，请重启数据库"),
	DB_ERROR1130("1130",RespCd.NCPS5001,"连接数据库失败，没有连接数据库的权限"),
	DB_ERROR1125("1125",RespCd.NCPS5001,"数据库用户不存在"),
	DB_ERROR1141("1141",RespCd.NCPS5001,"当前用户无权访问数据库"),
	DB_ERROR1142("1142",RespCd.NCPS5001,"当前用户无权访问数据表"),
	DB_ERROR1143("1143",RespCd.NCPS5001,"当前用户无权访问数据表中的字段"),
	DB_ERROR1146("1146",RespCd.NCPS5001,"数据表不存在"),
	DB_ERROR1147("1147",RespCd.NCPS5001,"未定义用户对数据表的访问权限"),
	DB_ERROR1148("1148",RespCd.NCPS5004,"字段不能为null"),
	DB_ERROR1149("1149",RespCd.NCPS5001,"SQL语句语法错误"),
	DB_ERROR1158("1158",RespCd.NCPS5001,"网络错误，出现读错误，请检查网络连接状况"),
	DB_ERROR1159("1159",RespCd.NCPS5001,"网络错误，读超时，请检查网络连接状况"),
	DB_ERROR1160("1160",RespCd.NCPS5001,"网络错误，出现写错误，请检查网络连接状况"),
	DB_ERROR1161("1161",RespCd.NCPS5001,"网络错误，写超时，请检查网络连接状况"),
	DB_ERROR1062("1062",RespCd.NCPS5002,"唯一索引重复，入库失败"),
	DB_ERROR1366("1366",RespCd.NCPS9404,"字段类型不匹配"),
	DB_ERROR1064("1064",RespCd.NCPS5001,"语法错误，常见的比如注释-- 后没加空格"),
	DB_ERROR1169("1169",RespCd.NCPS5001,"字段值重复，更新记录失败"),
	DB_ERROR1177("1177",RespCd.NCPS5001,"打开数据表失败"),
	DB_ERROR1180("1180",RespCd.NCPS5001,"提交事务失败"),
	DB_ERROR1181("1181",RespCd.NCPS5001,"回滚事务失败"),
	DB_ERROR1193("1193",RespCd.NCPS5001,"变量没声明，常在写存储过程时发生"),
	DB_ERROR1203("1203",RespCd.NCPS5001,"当前用户和数据库建立的连接已到达数据库的最大连接数，请增大可用的数据库连接数或重启数据库"),
	DB_ERROR1205("1205",RespCd.NCPS5001,"加锁超时"),
	DB_ERROR1211("1211",RespCd.NCPS5001,"当前用户没有创建用户的权限"),
	DB_ERROR1216("1216",RespCd.NCPS5001,"外键约束检查失败，更新子表记录失败"),
	DB_ERROR1217("1217",RespCd.NCPS5001,"外键约束检查失败，删除或修改主表记录失败"),
	DB_ERROR1227("1227",RespCd.NCPS5001,"权限不足，您无权进行此操作"),
	DB_ERROR1235("1235",RespCd.NCPS5001,"MySQL版本过低，不具有本功能"),
	DB_ERRORERRPR("error",RespCd.NCPS5001,"数据库未知错误");








	private String name;
	private String code;
	private String desc;

	
	DBErrorCdEnum(String code,String name,String desc){
		this.code = code;
		this.name = name;
		this.desc = desc;
	}
	
	DBErrorCdEnum(String code){
		this.code = code;
	} 

	public String getCode() {
		return code;
	}

	public String getName() {
		return name;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}
	public static DBErrorCdEnum getEnum(String code) {
		for (DBErrorCdEnum respCd : DBErrorCdEnum.values()) {
			if (respCd.getCode().equals(code)) {
				return respCd;
			}
		}
		return DB_ERRORERRPR;
	}
	public static String getValue(String code){
		 for (DBErrorCdEnum respCd : DBErrorCdEnum.values()) {
			if(respCd.getCode().equals(code)){
				return respCd.getName();
			}
		}
		 return RespCd.NCPS5001;
	 }
	public static String getDesc(String code){
		for (DBErrorCdEnum respCd : DBErrorCdEnum.values()) {
			if(respCd.getCode().equals(code)){
				return respCd.getDesc();
			}
		}
		return "";
	}

}



